import request from '@/utils/request'

/**
 * 获取员工列表
 * @param {*} page 当前页码
 * @param {*} size 当前页容量
 * @returns
 */
export const getEmployeesListApi = (page, size) => {
  return request({
    url: '/sys/user',
    method: 'get',
    params: {
      page,
      size
    }
  })
}

/**
 * 删除员工
 * @param {*} id
 * @returns
 */
export const delEmployeesApi = id => {
  return request({
    url: `/sys/user/${id}`,
    method: 'delete'
  })
}

/**
 * 新增员工
 * @param {*} data
 * @returns
 */
export const addEmployeesApi = data => {
  return request({
    url: '/sys/user',
    method: 'post',
    data
  })
}

/**
 * 批量导入员工
 * @param {*} data
 * @returns
 */
export const batchAddEmployeeApi = data => {
  return request({
    url: '/sys/user/batch',
    method: 'post',
    data
  })
}

/** *
 * 保存员工的基本信息
 * **/
export function saveUserDetailByIdApi(data) {
  return request({
    method: 'put',
    url: `/sys/user/${data.id}`,
    data
  })
}

/**
 * 提交员工角色
 * @param {*} data
 * @returns
 */
export const assignRoleApi = (data) => {
  return request({
    url: '/sys/user/assignRoles',
    method: 'put',
    data
  })
}
